import datetime
import os.path
import sys
import time

from selenium import webdriver
from selenium.webdriver.ie.service import Service
from webdriver_manager.microsoft import EdgeChromiumDriverManager


class Driver:
    driver=''
    options=''
    def __init__(self):
        self.options=webdriver.EdgeOptions()
        self.options.page_load_strategy="normal"
        self.driver=webdriver.Edge(service=Service(EdgeChromiumDriverManager().install()),options=self.options)
        self.driver.implicitly_wait(10)
    def photo(self):
        dirname=datetime.datetime.now().strftime("%Y-%m-%d")
        if not os.path.exists("../photo/"+dirname):
            os.mkdir("../photo/"+dirname)
        filename=sys._getframe().f_back.f_code.co_name+'-'+datetime.datetime.now().strftime("%Y-%m-%d-%H%M%S")+".png"
        self.driver.save_screenshot("../photo/"+dirname+"/"+filename)
MDriver=Driver()